// var babelpolyfill = require('babel-polyfill')
const path=require("path")
const HtmlWebpackPlugin=require('html-webpack-plugin')
const VueLoaderPlugin=require('vue-loader/lib/plugin')
module.exports={
  mode:"development",
  devtool:"source-map ",
  plugins:[new HtmlWebpackPlugin({template:'./index.html'}),new VueLoaderPlugin()],
  entry:'./src/main.js',
  output:{
    path:path.resolve(__dirname,"./dist"),
    filename:"[name].js"
  },
  module:{
    rules:[
      {test:/\.css$/,loader:["vue-style-loader","style-loader","css-loader"]},
      {test:/\.less$/,loader:["vue-style-loader","style-loader","css-loader","less-loader"]},
      {test:/\.js$/,loader:["babel-loader"],exclude:/node_modules/},
      {test:/\.vue$/,loader:["vue-loader"]},
      {
        test: /\.(jpg|jpeg|png|gif|svg)$/,
        loader: "file-loader",
        options: {
          esModule: false, // 默认值是 true，需要手动改成 false
          name: "[path][name].[hash:8].[ext]"
        }
      },
      {test:/\.(woff|woff2|eot|ttf|otf)$/,loader:"file-loader",options:{
        name:'[path][name][hash].[ext]'
      }}
    ]
  },
  resolve:{
    alias:{
      'vue$': 'vue/dist/vue.esm.js',

    }
  }
}